package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum MemberCardStatus {
	
	OVERDUE(0,"过期"),
	NORMAL(1,"正常"),
	NOT_ACTIVE(2,"待激活");
	
	private Integer status;
	
	private String value;

	private MemberCardStatus(Integer status,String value){
		this.status = status;
		this.value = value;
	}

	public int toIntStatus() {
		return this.status;
	}
	
	public String toStringValue() {
		return this.value;
	}

	public static MemberCardStatus toFlag(int status) {
		if (OVERDUE.status == status) {
			return OVERDUE;
		} else if (NORMAL.status == status) {
			return NORMAL;
		}else if (NOT_ACTIVE.status == status) {
			return NOT_ACTIVE;
		}else {
			throw new InvalidArgumentException("Unknown status[" + status + "].");
		}
	}
}
